home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 July / Chip Temmuz 2004.iso / program / antispam / RazorAgent_SDK / razor-agents-sdk-2.03.exe / URI-1.19 / t / rfc2732.t < prev    next >
Encoding:
Text File  |  2001-05-15  |  1.3 KB  |  45 lines

  1. print "1..9\n";
  2.  
  3. use strict;
  4. use URI;
  5. my $uri = URI->new("http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html");
  6.  
  7. print "not " unless $uri->as_string eq "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html";
  8. print "ok 1\n";
  9.  
  10. print "not " unless $uri->host eq "[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]";
  11. print "ok 2\n";
  12.  
  13. print "not " unless $uri->host_port eq "[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80";
  14. print "ok 3\n";
  15.  
  16. print "not " unless $uri->port eq "80";
  17. print "ok 4\n";
  18.  
  19. $uri->host("host");
  20. print "not " unless $uri->as_string eq "http://host:80/index.html";
  21. print "ok 5\n";
  22.  
  23. $uri = URI->new("ftp://ftp:@[3ffe:2a00:100:7031::1]");
  24. print "not " unless $uri->as_string eq "ftp://ftp:@[3ffe:2a00:100:7031::1]";
  25. print "ok 6\n";
  26.  
  27. print "not " unless $uri->port eq "21" && !$uri->_port;
  28. print "ok 7\n";
  29.  
  30. print "not " unless $uri->host("ftp") eq "[3ffe:2a00:100:7031::1]";
  31. print "ok 8\n";
  32.  
  33. print "not " unless $uri eq "ftp://ftp:\@ftp";
  34. print "ok 9\n";
  35.  
  36. __END__
  37.  
  38.       http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
  39.       http://[1080:0:0:0:8:800:200C:417A]/index.html
  40.       http://[3ffe:2a00:100:7031::1]
  41.       http://[1080::8:800:200C:417A]/foo
  42.       http://[::192.9.5.5]/ipng
  43.       http://[::FFFF:129.144.52.38]:80/index.html
  44.       http://[2010:836B:4179::836B:4179]
  45.